RTECO-1017 - Enrich User-Agent with agent/CI context and reuse Cursor…#3468
Open
fluxxBot wants to merge 2 commits into
Open
RTECO-1017 - Enrich User-Agent with agent/CI context and reuse Cursor…#3468fluxxBot wants to merge 2 commits into
fluxxBot wants to merge 2 commits into
Conversation
… trace ID for API calls
…22-89ba093adf6b and refactor User-Agent setting in main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
masterbranch.go vet ./....go fmt ./....Summary
Wires the invocation-context detection from jfrog-cli-core PR #1555 into
jf:User-Agentheader sent to Artifactory.CURSOR_TRACE_ID(when invoked from Cursor) as the Uber Trace ID instead of generating a fresh one, so server-side logs correlate end-to-end with the agent's trace.Motivation
RTECO-1017: differentiate human / CI / agent invocations of
jf. Surface agent identity in every API call so support and observability can attribute traffic correctly without parsing metric payloads separately.Changes
main.go:setUberTraceIdTokenreusesExecutionContext.TraceID(currentlyCURSOR_TRACE_ID) when present; falls back to the existing 16-char hex generator otherwise.clientutils.SetUserAgentnow callscorecommands.EnrichUserAgent(base)which appends(agent; ci=<system>)to the base CLI User-Agent. Returns base unchanged when neither agent nor CI is detected.go.mod— points at the published pre-release of jfrog-cli-core that contains the detection logic. Must be bumped to the final tagged version once core PR Allow option to disable the 'npm ls' command being triggered in the background during JFrog CLI run ( NPM ) #1555 merges.Examples
jfrog-cli-go/2.103.0jfrog-cli-go/2.103.0 (claude)jfrog-cli-go/2.103.0 (cursor)jfrog-cli-go/2.103.0 (cursor; ci=github_actions)jfrog-cli-go/2.103.0 (ci=github_actions)Trace-ID propagation
CURSOR_TRACE_IDis reused when the detected agent iscursor. For all other agents, a fresh 16-char hex trace ID is generated as before. Gated on agent identity — prevents stale values leaked from an outer shell being used when a different agent is the real invoker.Memoization (sync.Once in core)
DetectExecutionContext()is called from two places inmain.go—EnrichUserAgentandsetUberTraceIdToken. Both return the same cached snapshot (memoized viasync.Oncein core on first call). No divergence possible even if env mutates between calls.